package com.wrs.wrsfcmpush.service;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.AppUtils;
import com.wrs.wrsfcmpush.R;
import com.wrs.wrsfcmpush.utils.NotificationUtils;
import com.wrs.wrsfcmpush.utils.TaskUtils;

public class KeepServices extends Service {
    private NotificationManager notificationManager;
    private String notificationId = "serviceid";
    private String notificationName = "servicename";
    private String tag = "保活 KeepServices";

    @Override
    public void onCreate() {
        super.onCreate();
        NotificationUtils.startNot(this, this);
    }

    private Notification getNotification() {
        Notification.Builder builder = new Notification.Builder(this)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle("title")
                .setContentText("text");
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setChannelId(notificationId);
        }
        Notification notification = builder.build();
        return notification;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        TaskUtils.startTask(tag, getApplicationContext(), this);


        return super.onStartCommand(intent, flags, startId);
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {

        return null;
    }



    @Override
    public void onDestroy() {
        super.onDestroy();

    }

}
